package gsp420;

import java.awt.BorderLayout;

import javax.swing.JApplet;
import javax.swing.JFrame;

//<APPLET CODE="gsp420.FirstProject.class" ARCHIVE="firstproject.jar" WIDTH=640 HEIGHT=480></APPLET>
/**
 * a simple Java application, also an Applet!
 */
public class FirstProject extends JApplet
{
	private static final long serialVersionUID = 1L;

	public void init()
	{
		GamePanel gp = new GamePanel(this);
		setLayout(new BorderLayout());
		add(gp, BorderLayout.CENTER);
	}

	public static void main(String[] args)
	{
		int someNumber = 5;
		// boolean // 1 byte
		// byte // 1 byte
		// char //* 1 OR 2 bytes
		// short // 2 bytes
		// int //* 4 bytes
		// long //* 8 bytes
		// float // 4 bytes
		// double // 8 bytes
		// String // 12+length()
		int[] someNumbers = new int[] { 1, 2, 3, 4, 5 };
		// int[] someNumbers = new int[5];
		try
		{
//			int j = 0;
//			j = 1 / j;
			String str = null;
			int a = str.charAt(0);
			for (int i = 0; i < someNumbers.length + 1; ++i)
			{
				System.out.println("Hello World! " + (someNumbers[i]));
			}
		}catch(ArithmeticException e) 
		{
			System.out.println("MATH PROBLEMZ!");
		}
		catch(ArrayIndexOutOfBoundsException e){
			System.out.println("INDEX PROBLEMZ!!!11!1!one!");
		}
		catch (Exception e)
		{
			System.out.println("there was a problem... "+e.toString());
			e.printStackTrace();
		}
		int width = 8, height = 8;
		// byte[][] map = new byte[height][width];
		byte[][] map = new byte[height][];
		for (int h = 0; h < height; ++h)
		{
			map[h] = new byte[width];
		}

		JFrame myWindow = new JFrame("Hi");
		myWindow.setSize(400, 400);
		myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		GamePanel gp = new GamePanel(null);
		myWindow.add(gp);
		myWindow.setVisible(true);
	}
}
